package gui;

import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Cursor;
import javafx.scene.Scene;

/**
 * @author Bas Dobbelsteen
 * @author Etienne Bruines
 */
public class CursorManager 
{
	public CursorManager(final Settings mainSettings, final Scene mainScene)
	{
		mainSettings.modeProperty().addListener(new ChangeListener<Mode>() {
			@Override public void changed(ObservableValue<? extends Mode> observable,	Mode oldValue, Mode newValue)
			{
				// TODO: willen we iets doen wanneer de current mode of operations veranderd?
				switch (newValue)
				{
				case Rectangle:
				case Line:
				case Ellipse:
				case Triangle:
					mainScene.setCursor(Cursor.CROSSHAIR);
					break;
				case Text:
					mainScene.setCursor(Cursor.TEXT);
					break;
				case Drag:
				case Modify:
					mainScene.setCursor(Cursor.MOVE);
					break;
				default:
					mainScene.setCursor(Cursor.DEFAULT);
					break;
				}
				System.out.println("Mode changed from " + oldValue.toString() + " to " + newValue.toString());
			}
		});
	}
}
